home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / ladybug.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  22KB  |  566 lines

  1. /***************************************************************************
  2.  
  3. Lady Bug memory map (preliminary)
  4.  
  5. driver by Nicola Salmoria
  6.  
  7. 0000-5fff ROM
  8. 6000-6fff RAM
  9. d000-d3ff video RAM
  10.           d000-d007/d020-d027/d040-d047/d060-d067 contain the column scroll
  11.           registers (not used by Lady Bug)
  12. d400-d7ff color RAM (4 bits wide)
  13.  
  14. memory mapped ports:
  15.  
  16. read:
  17. 9000      IN0
  18. 9001      IN1
  19. 9002      DSW0
  20. 9003      DSW1
  21. e000      IN2 (not used by Lady Bug)
  22. 8000      interrupt enable? (toggle)?
  23. see the input_ports definition below for details on the input bits
  24.  
  25. write:
  26. 7000-73ff sprites
  27. a000      flip screen
  28. b000      sound port 1
  29. c000      sound port 2
  30.  
  31. interrupts:
  32. There is no vblank interrupt. The vblank status is read from IN1.
  33. Coin insertion in left slot generates a NMI, in right slot an IRQ.
  34.  
  35. ***************************************************************************/
  36.  
  37. #include "driver.h"
  38. #include "vidhrdw/generic.h"
  39.  
  40.  
  41.  
  42. READ_HANDLER( ladybug_IN0_r );
  43. READ_HANDLER( ladybug_IN1_r );
  44. int ladybug_interrupt(void);
  45.  
  46. void ladybug_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  47. WRITE_HANDLER( ladybug_flipscreen_w );
  48. void ladybug_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  49.  
  50.  
  51.  
  52. static struct MemoryReadAddress readmem[] =
  53. {
  54.     { 0x0000, 0x5fff, MRA_ROM },
  55.     { 0x6000, 0x6fff, MRA_RAM },
  56.     { 0x8000, 0x8fff, MRA_NOP },
  57.     { 0x9000, 0x9000, input_port_0_r },    /* IN0 */
  58.     { 0x9001, 0x9001, input_port_1_r },    /* IN1 */
  59.     { 0x9002, 0x9002, input_port_3_r },    /* DSW0 */
  60.     { 0x9003, 0x9003, input_port_4_r },    /* DSW1 */
  61.     { 0xd000, 0xd7ff, MRA_RAM },    /* video and color RAM */
  62.     { 0xe000, 0xe000, input_port_2_r },    /* IN2 */
  63.     { -1 }    /* end of table */
  64. };
  65.  
  66. static struct MemoryWriteAddress writemem[] =
  67. {
  68.     { 0x0000, 0x5fff, MWA_ROM },
  69.     { 0x6000, 0x6fff, MWA_RAM },
  70.     { 0x7000, 0x73ff, MWA_RAM, &spriteram, &spriteram_size },
  71.     { 0xa000, 0xa000, ladybug_flipscreen_w },
  72.     { 0xb000, 0xbfff, SN76496_0_w },
  73.     { 0xc000, 0xcfff, SN76496_1_w },
  74.     { 0xd000, 0xd3ff, videoram_w, &videoram, &videoram_size },
  75.     { 0xd400, 0xd7ff, colorram_w, &colorram },
  76.     { -1 }    /* end of table */
  77. };
  78.  
  79.  
  80.  
  81. /***************************************************************************
  82.  
  83.   Lady Bug doesn't have VBlank interrupts.
  84.   Interrupts are still used by the game: but they are related to coin
  85.   slots. Left slot generates a NMI, Right slot an IRQ.
  86.  
  87. ***************************************************************************/
  88. int ladybug_interrupt(void)
  89. {
  90.     if (readinputport(5) & 1)    /* Left Coin */
  91.         return nmi_interrupt();
  92.     else if (readinputport(5) & 2)    /* Right Coin */
  93.         return interrupt();
  94.     else return ignore_interrupt();
  95. }
  96.  
  97. INPUT_PORTS_START( ladybug )
  98.     PORT_START    /* IN0 */
  99.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY )
  100.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY )
  101.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY )
  102.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY )
  103.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_UNUSED )
  104.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
  105.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  106.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_TILT )
  107.  
  108.     PORT_START    /* IN1 */
  109.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_4WAY | IPF_COCKTAIL )
  110.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_4WAY | IPF_COCKTAIL )
  111.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_4WAY | IPF_COCKTAIL )
  112.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_4WAY | IPF_COCKTAIL )
  113.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  114.     /* This should be connected to the 4V clock. I don't think the game uses it. */
  115.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  116.     /* Note that there are TWO VBlank inputs, one is active low, the other active */
  117.     /* high. There are probably other differencies in the hardware, but emulating */
  118.     /* them this way is enough to get the game running. */
  119.     PORT_BIT( 0xc0, 0x40, IPT_VBLANK )
  120.  
  121.     PORT_START    /* IN2 */
  122.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_UNUSED )
  123.     PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED )
  124.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  125.     PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
  126.  
  127.     PORT_START    /* DSW0 */
  128.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
  129.     PORT_DIPSETTING(    0x03, "Easy" )
  130.     PORT_DIPSETTING(    0x02, "Medium" )
  131.     PORT_DIPSETTING(    0x01, "Hard" )
  132.     PORT_DIPSETTING(    0x00, "Hardest" )
  133.     PORT_DIPNAME( 0x04, 0x04, "High Score Names" )
  134.     PORT_DIPSETTING(    0x00, "3 Letters" )
  135.     PORT_DIPSETTING(    0x04, "10 Letters" )
  136.     PORT_BITX(    0x08, 0x08, IPT_DIPSWITCH_NAME | IPF_CHEAT, "Rack Test", KEYCODE_F1, IP_JOY_NONE )
  137.     PORT_DIPSETTING(    0x08, DEF_STR( Off ) )
  138.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  139.     PORT_DIPNAME( 0x10, 0x10, "Freeze" )
  140.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  141.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  142.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Cabinet ) )
  143.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  144.     PORT_DIPSETTING(    0x20, DEF_STR( Cocktail ) )
  145.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
  146.     PORT_DIPSETTING(    0x40, DEF_STR( No ) )
  147.     PORT_DIPSETTING(    0x00, DEF_STR( Yes ) )
  148.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Lives ) )
  149.     PORT_DIPSETTING(    0x80, "3" )
  150.     PORT_DIPSETTING(    0x00, "5" )
  151.  
  152.     PORT_START    /* DSW1 */
  153.     PORT_DIPNAME( 0x0f, 0x0f, "Right Coin" )
  154.     PORT_DIPSETTING(    0x06, DEF_STR( 4C_1C ) )
  155.     PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) )
  156.     PORT_DIPSETTING(    0x0a, DEF_STR( 2C_1C ) )
  157.     PORT_DIPSETTING(    0x07, DEF_STR( 3C_2C ) )
  158.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  159.     PORT_DIPSETTING(    0x09, DEF_STR( 2C_3C ) )
  160.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  161.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  162.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  163.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  164.     /* settings 0x00 thru 0x05 all give 1 Coin/1 Credit */
  165.     PORT_DIPNAME( 0xf0, 0xf0, "Left Coin" )
  166.     PORT_DIPSETTING(    0x60, DEF_STR( 4C_1C ) )
  167.     PORT_DIPSETTING(    0x80, DEF_STR( 3C_1C ) )
  168.     PORT_DIPSETTING(    0xa0, DEF_STR( 2C_1C ) )
  169.     PORT_DIPSETTING(    0x70, DEF_STR( 3C_2C ) )
  170.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  171.     PORT_DIPSETTING(    0x90, DEF_STR( 2C_3C ) )
  172.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  173.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  174.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  175.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  176.     /* settings 0x00 thru 0x50 all give 1 Coin/1 Credit */
  177.  
  178.     PORT_START    /* FAKE */
  179.     /* The coin slots are not memory mapped. Coin Left causes a NMI, */
  180.     /* Coin Right an IRQ. This fake input port is used by the interrupt */
  181.     /* handler to be notified of coin insertions. We use IMPULSE to */
  182.     /* trigger exactly one interrupt, without having to check when the */
  183.     /* user releases the key. */
  184.     PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  185.     PORT_BIT_IMPULSE( 0x02, IP_ACTIVE_HIGH, IPT_COIN2, 1 )
  186. INPUT_PORTS_END
  187.  
  188. INPUT_PORTS_START( snapjack )
  189.     PORT_START    /* IN0 */
  190.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  191.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  192.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  193.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  194.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_UNUSED )
  195.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
  196.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  197.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_TILT )
  198.  
  199.     PORT_START    /* IN1 */
  200.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  201.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  202.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  203.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  204.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  205.     /* This should be connected to the 4V clock. I don't think the game uses it. */
  206.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  207.     /* Note that there are TWO VBlank inputs, one is active low, the other active */
  208.     /* high. There are probably other differencies in the hardware, but emulating */
  209.     /* them this way is enough to get the game running. */
  210.     PORT_BIT( 0xc0, 0x40, IPT_VBLANK )
  211.  
  212.     PORT_START    /* IN2 */
  213.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_UNUSED  )
  214.     PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED )
  215.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  216.     PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
  217.  
  218.     PORT_START    /* DSW0 */
  219.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
  220.     PORT_DIPSETTING(    0x03, "Easy" )
  221.     PORT_DIPSETTING(    0x02, "Medium" )
  222.     PORT_DIPSETTING(    0x01, "Hard" )
  223.     PORT_DIPSETTING(    0x00, "Hardest" )
  224.     PORT_DIPNAME( 0x04, 0x04, "High Score Names" )
  225.     PORT_DIPSETTING(    0x00, "3 Letters" )
  226.     PORT_DIPSETTING(    0x04, "10 Letters" )
  227.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) )
  228.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  229.     PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )
  230.     PORT_DIPNAME( 0x10, 0x00, "unused1?" )
  231.     PORT_DIPSETTING(    0x10, DEF_STR( Off ) )
  232.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  233.     PORT_DIPNAME( 0x20, 0x00, "unused2?" )
  234.     PORT_DIPSETTING(    0x20, DEF_STR( Off ) )
  235.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  236.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
  237.     PORT_DIPSETTING(    0x00, "2" )
  238.     PORT_DIPSETTING(    0xc0, "3" )
  239.     PORT_DIPSETTING(    0x80, "4" )
  240.     PORT_DIPSETTING(    0x40, "5" )
  241.  
  242.     PORT_START    /* DSW1 */
  243.     /* coinage is slightly different from Lady Bug and Cosmic Avenger */
  244.     PORT_DIPNAME( 0x0f, 0x0f, "Right Coin" )
  245.     PORT_DIPSETTING(    0x05, DEF_STR( 4C_1C ) )
  246.     PORT_DIPSETTING(    0x07, DEF_STR( 3C_1C ) )
  247.     PORT_DIPSETTING(    0x0a, DEF_STR( 2C_1C ) )
  248.     PORT_DIPSETTING(    0x06, DEF_STR( 3C_2C ) )
  249.     PORT_DIPSETTING(    0x09, DEF_STR( 2C_2C ) )
  250.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  251.     PORT_DIPSETTING(    0x08, DEF_STR( 2C_3C ) )
  252.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  253.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  254.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  255.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  256.     /* settings 0x00 thru 0x04 all give 1 Coin/1 Credit */
  257.     PORT_DIPNAME( 0xf0, 0xf0, "Left Coin" )
  258.     PORT_DIPSETTING(    0x50, DEF_STR( 4C_1C ) )
  259.     PORT_DIPSETTING(    0x70, DEF_STR( 3C_1C ) )
  260.     PORT_DIPSETTING(    0xa0, DEF_STR( 2C_1C ) )
  261.     PORT_DIPSETTING(    0x60, DEF_STR( 3C_2C ) )
  262.     PORT_DIPSETTING(    0x90, DEF_STR( 2C_2C ) )
  263.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  264.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_3C ) )
  265.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  266.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  267.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  268.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  269.     /* settings 0x00 thru 0x04 all give 1 Coin/1 Credit */
  270.  
  271.     PORT_START    /* FAKE */
  272.     /* The coin slots are not memory mapped. Coin Left causes a NMI, */
  273.     /* Coin Right an IRQ. This fake input port is used by the interrupt */
  274.     /* handler to be notified of coin insertions. We use IMPULSE to */
  275.     /* trigger exactly one interrupt, without having to check when the */
  276.     /* user releases the key. */
  277.     PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  278.     PORT_BIT_IMPULSE( 0x02, IP_ACTIVE_HIGH, IPT_COIN2, 1 )
  279. INPUT_PORTS_END
  280.  
  281. INPUT_PORTS_START( cavenger )
  282.     PORT_START    /* IN0 */
  283.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  284.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  285.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  286.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  287.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  288.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
  289.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_START2 )
  290.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_TILT )
  291.  
  292.     PORT_START    /* IN1 */
  293.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  294.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  295.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  296.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  297.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  298.     /* This should be connected to the 4V clock. I don't think the game uses it. */
  299.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  300.     /* Note that there are TWO VBlank inputs, one is active low, the other active */
  301.     /* high. There are probably other differencies in the hardware, but emulating */
  302.     /* them this way is enough to get the game running. */
  303.     PORT_BIT( 0xc0, 0x40, IPT_VBLANK )
  304.  
  305.     PORT_START    /* IN2 */
  306.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
  307.     PORT_BIT( 0x0e, IP_ACTIVE_LOW, IPT_UNUSED )
  308.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  309.     PORT_BIT( 0xe0, IP_ACTIVE_LOW, IPT_UNUSED )
  310.  
  311.     PORT_START    /* DSW0 */
  312.     PORT_DIPNAME( 0x03, 0x03, DEF_STR( Difficulty ) )
  313.     PORT_DIPSETTING(    0x03, "Easy" )
  314.     PORT_DIPSETTING(    0x02, "Medium" )
  315.     PORT_DIPSETTING(    0x01, "Hard" )
  316.     PORT_DIPSETTING(    0x00, "Hardest" )
  317.     PORT_DIPNAME( 0x04, 0x04, "High Score Names" )
  318.     PORT_DIPSETTING(    0x00, "3 Letters" )
  319.     PORT_DIPSETTING(    0x04, "10 Letters" )
  320.     PORT_DIPNAME( 0x08, 0x00, DEF_STR( Cabinet ) )
  321.     PORT_DIPSETTING(    0x00, DEF_STR( Upright ) )
  322.     PORT_DIPSETTING(    0x08, DEF_STR( Cocktail ) )
  323.     PORT_DIPNAME( 0x30, 0x00, "Initial High Score" )
  324.     PORT_DIPSETTING(    0x00, "0" )
  325.     PORT_DIPSETTING(    0x30, "5000" )
  326.     PORT_DIPSETTING(    0x20, "8000" )
  327.     PORT_DIPSETTING(    0x10, "10000" )
  328.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Lives ) )
  329.     PORT_DIPSETTING(    0x00, "2" )
  330.     PORT_DIPSETTING(    0xc0, "3" )
  331.     PORT_DIPSETTING(    0x80, "4" )
  332.     PORT_DIPSETTING(    0x40, "5" )
  333.  
  334.     PORT_START    /* DSW1 */
  335.     PORT_DIPNAME( 0x0f, 0x0f, "Right Coin" )
  336.     PORT_DIPSETTING(    0x06, DEF_STR( 4C_1C ) )
  337.     PORT_DIPSETTING(    0x08, DEF_STR( 3C_1C ) )
  338.     PORT_DIPSETTING(    0x0a, DEF_STR( 2C_1C ) )
  339.     PORT_DIPSETTING(    0x07, DEF_STR( 3C_2C ) )
  340.     PORT_DIPSETTING(    0x0f, DEF_STR( 1C_1C ) )
  341.     PORT_DIPSETTING(    0x09, DEF_STR( 2C_3C ) )
  342.     PORT_DIPSETTING(    0x0e, DEF_STR( 1C_2C ) )
  343.     PORT_DIPSETTING(    0x0d, DEF_STR( 1C_3C ) )
  344.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  345.     PORT_DIPSETTING(    0x0b, DEF_STR( 1C_5C ) )
  346.     /* settings 0x00 thru 0x05 all give 1 Coin/1 Credit */
  347.     PORT_DIPNAME( 0xf0, 0xf0, "Left Coin" )
  348.     PORT_DIPSETTING(    0x60, DEF_STR( 4C_1C ) )
  349.     PORT_DIPSETTING(    0x80, DEF_STR( 3C_1C ) )
  350.     PORT_DIPSETTING(    0xa0, DEF_STR( 2C_1C ) )
  351.     PORT_DIPSETTING(    0x70, DEF_STR( 3C_2C ) )
  352.     PORT_DIPSETTING(    0xf0, DEF_STR( 1C_1C ) )
  353.     PORT_DIPSETTING(    0x90, DEF_STR( 2C_3C ) )
  354.     PORT_DIPSETTING(    0xe0, DEF_STR( 1C_2C ) )
  355.     PORT_DIPSETTING(    0xd0, DEF_STR( 1C_3C ) )
  356.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_4C ) )
  357.     PORT_DIPSETTING(    0xb0, DEF_STR( 1C_5C ) )
  358.     /* settings 0x00 thru 0x50 all give 1 Coin/1 Credit */
  359.  
  360.     PORT_START    /* FAKE */
  361.     /* The coin slots are not memory mapped. Coin Left causes a NMI, */
  362.     /* Coin Right an IRQ. This fake input port is used by the interrupt */
  363.     /* handler to be notified of coin insertions. We use IMPULSE to */
  364.     /* trigger exactly one interrupt, without having to check when the */
  365.     /* user releases the key. */
  366.     PORT_BIT_IMPULSE( 0x01, IP_ACTIVE_HIGH, IPT_COIN1, 1 )
  367.     PORT_BIT_IMPULSE( 0x02, IP_ACTIVE_HIGH, IPT_COIN2, 1 )
  368. INPUT_PORTS_END
  369.  
  370.  
  371.  
  372. static struct GfxLayout charlayout =
  373. {
  374.     8,8,    /* 8*8 characters */
  375.     512,    /* 512 characters */
  376.     2,    /* 2 bits per pixel */
  377.     { 0, 512*8*8 },    /* the two bitplanes are separated */
  378.     { 7, 6, 5, 4, 3, 2, 1, 0 },
  379.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 },
  380.     8*8    /* every char takes 8 consecutive bytes */
  381. };
  382. static struct GfxLayout spritelayout =
  383. {
  384.     16,16,    /* 16*16 sprites */
  385.     128,    /* 128 sprites */
  386.     2,    /* 2 bits per pixel */
  387.     { 1, 0 },    /* the two bitplanes are packed in two consecutive bits */
  388.     { 0, 2, 4, 6, 8, 10, 12, 14,
  389.             8*16+0, 8*16+2, 8*16+4, 8*16+6, 8*16+8, 8*16+10, 8*16+12, 8*16+14 },
  390.     { 23*16, 22*16, 21*16, 20*16, 19*16, 18*16, 17*16, 16*16,
  391.             7*16, 6*16, 5*16, 4*16, 3*16, 2*16, 1*16, 0*16 },
  392.     64*8    /* every sprite takes 64 consecutive bytes */
  393. };
  394. static struct GfxLayout spritelayout2 =
  395. {
  396.     8,8,    /* 8*8 sprites */
  397.     512,    /* 512 sprites */
  398.     2,    /* 2 bits per pixel */
  399.     { 1, 0 },    /* the two bitplanes are packed in two consecutive bits */
  400.     { 0, 2, 4, 6, 8, 10, 12, 14 },
  401.     { 7*16, 6*16, 5*16, 4*16, 3*16, 2*16, 1*16, 0*16 },
  402.     16*8    /* every sprite takes 16 consecutive bytes */
  403. };
  404.  
  405. static struct GfxDecodeInfo gfxdecodeinfo[] =
  406. {
  407.     { REGION_GFX1, 0, &charlayout,      0,  8 },
  408.     { REGION_GFX2, 0, &spritelayout,  4*8, 16 },
  409.     { REGION_GFX2, 0, &spritelayout2, 4*8, 16 },
  410.     { -1 } /* end of array */
  411. };
  412.  
  413.  
  414. static struct SN76496interface sn76496_interface =
  415. {
  416.     2,    /* 2 chips */
  417.     { 4000000, 4000000 },    /* 4 MHz */
  418.     { 100, 100 }
  419. };
  420.  
  421.  
  422.  
  423. static struct MachineDriver machine_driver_ladybug =
  424. {
  425.     /* basic machine hardware */
  426.     {
  427.         {
  428.             CPU_Z80,
  429.             4000000,    /* 4 Mhz */
  430.             readmem,writemem,0,0,
  431.             ladybug_interrupt,1
  432.         }
  433.     },
  434.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  435.     1,    /* single CPU, no need for interleaving */
  436.     0,
  437.  
  438.     /* video hardware */
  439.     32*8, 32*8, { 1*8, 31*8-1, 4*8, 28*8-1 },
  440.     gfxdecodeinfo,
  441.     32,4*24,
  442.     ladybug_vh_convert_color_prom,
  443.  
  444.     VIDEO_TYPE_RASTER,
  445.     0,
  446.     generic_vh_start,
  447.     generic_vh_stop,
  448.     ladybug_vh_screenrefresh,
  449.  
  450.     /* sound hardware */
  451.     0,0,0,0,
  452.     {
  453.         {
  454.             SOUND_SN76496,
  455.             &sn76496_interface
  456.         }
  457.     }
  458. };
  459.  
  460.  
  461.  
  462. /***************************************************************************
  463.  
  464.   Game driver(s)
  465.  
  466. ***************************************************************************/
  467.  
  468. ROM_START( ladybug )
  469.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  470.     ROM_LOAD( "lb1.cpu",      0x0000, 0x1000, 0xd09e0adb )
  471.     ROM_LOAD( "lb2.cpu",      0x1000, 0x1000, 0x88bc4a0a )
  472.     ROM_LOAD( "lb3.cpu",      0x2000, 0x1000, 0x53e9efce )
  473.     ROM_LOAD( "lb4.cpu",      0x3000, 0x1000, 0xffc424d7 )
  474.     ROM_LOAD( "lb5.cpu",      0x4000, 0x1000, 0xad6af809 )
  475.     ROM_LOAD( "lb6.cpu",      0x5000, 0x1000, 0xcf1acca4 )
  476.  
  477.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  478.     ROM_LOAD( "lb9.vid",      0x0000, 0x1000, 0x77b1da1e )
  479.     ROM_LOAD( "lb10.vid",     0x1000, 0x1000, 0xaa82e00b )
  480.  
  481.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  482.     ROM_LOAD( "lb8.cpu",      0x0000, 0x1000, 0x8b99910b )
  483.     ROM_LOAD( "lb7.cpu",      0x1000, 0x1000, 0x86a5b448 )
  484.  
  485.     ROM_REGION( 0x0060, REGION_PROMS )
  486.     ROM_LOAD( "10-2.vid",     0x0000, 0x0020, 0xdf091e52 ) /* palette */
  487.     ROM_LOAD( "10-1.vid",     0x0020, 0x0020, 0x40640d8f ) /* sprite color lookup table */
  488.     ROM_LOAD( "10-3.vid",     0x0040, 0x0020, 0x27fa3a50 ) /* ?? */
  489. ROM_END
  490.  
  491. ROM_START( ladybugb )
  492.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  493.     ROM_LOAD( "lb1a.cpu",     0x0000, 0x1000, 0xec135e54 )
  494.     ROM_LOAD( "lb2a.cpu",     0x1000, 0x1000, 0x3049c5c6 )
  495.     ROM_LOAD( "lb3a.cpu",     0x2000, 0x1000, 0xb0fef837 )
  496.     ROM_LOAD( "lb4.cpu",      0x3000, 0x1000, 0xffc424d7 )
  497.     ROM_LOAD( "lb5.cpu",      0x4000, 0x1000, 0xad6af809 )
  498.     ROM_LOAD( "lb6a.cpu",     0x5000, 0x1000, 0x88c8002a )
  499.  
  500.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  501.     ROM_LOAD( "lb9.vid",      0x0000, 0x1000, 0x77b1da1e )
  502.     ROM_LOAD( "lb10.vid",     0x1000, 0x1000, 0xaa82e00b )
  503.  
  504.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  505.     ROM_LOAD( "lb8.cpu",      0x0000, 0x1000, 0x8b99910b )
  506.     ROM_LOAD( "lb7.cpu",      0x1000, 0x1000, 0x86a5b448 )
  507.  
  508.     ROM_REGION( 0x0060, REGION_PROMS )
  509.     ROM_LOAD( "10-2.vid",     0x0000, 0x0020, 0xdf091e52 ) /* palette */
  510.     ROM_LOAD( "10-1.vid",     0x0020, 0x0020, 0x40640d8f ) /* sprite color lookup table */
  511.     ROM_LOAD( "10-3.vid",     0x0040, 0x0020, 0x27fa3a50 ) /* ?? */
  512. ROM_END
  513.  
  514. ROM_START( snapjack )
  515.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  516.     ROM_LOAD( "sj2a.bin",     0x0000, 0x1000, 0x6b30fcda )
  517.     ROM_LOAD( "sj2b.bin",     0x1000, 0x1000, 0x1f1088d1 )
  518.     ROM_LOAD( "sj2c.bin",     0x2000, 0x1000, 0xedd65f3a )
  519.     ROM_LOAD( "sj2d.bin",     0x3000, 0x1000, 0xf4481192 )
  520.     ROM_LOAD( "sj2e.bin",     0x4000, 0x1000, 0x1bff7d05 )
  521.     ROM_LOAD( "sj2f.bin",     0x5000, 0x1000, 0x21793edf )
  522.  
  523.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  524.     ROM_LOAD( "sj2i.bin",     0x0000, 0x1000, 0xff2011c7 )
  525.     ROM_LOAD( "sj2j.bin",     0x1000, 0x1000, 0xf097babb )
  526.  
  527.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  528.     ROM_LOAD( "sj2h.bin",     0x0000, 0x1000, 0xb7f105b6 )
  529.     ROM_LOAD( "sj2g.bin",     0x1000, 0x1000, 0x1cdb03a8 )
  530.  
  531.     ROM_REGION( 0x0060, REGION_PROMS )
  532.     ROM_LOAD( "sj8t.bin",     0x0000, 0x0020, 0xcbbd9dd1 ) /* palette */
  533.     ROM_LOAD( "sj9k.bin",     0x0020, 0x0020, 0x5b16fbd2 ) /* sprite color lookup table */
  534.     ROM_LOAD( "sj9h.bin",     0x0040, 0x0020, 0x27fa3a50 ) /* ?? */
  535. ROM_END
  536.  
  537. ROM_START( cavenger )
  538.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  539.     ROM_LOAD( "1",            0x0000, 0x1000, 0x9e0cc781 )
  540.     ROM_LOAD( "2",            0x1000, 0x1000, 0x5ce5b950 )
  541.     ROM_LOAD( "3",            0x2000, 0x1000, 0xbc28218d )
  542.     ROM_LOAD( "4",            0x3000, 0x1000, 0x2b32e9f5 )
  543.     ROM_LOAD( "5",            0x4000, 0x1000, 0xd117153e )
  544.     ROM_LOAD( "6",            0x5000, 0x1000, 0xc7d366cb )
  545.  
  546.     ROM_REGION( 0x2000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  547.     ROM_LOAD( "9",            0x0000, 0x1000, 0x63357785 )
  548.     ROM_LOAD( "0",            0x1000, 0x1000, 0x52ad1133 )
  549.  
  550.     ROM_REGION( 0x2000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  551.     ROM_LOAD( "8",            0x0000, 0x1000, 0xb022bf2d )
  552.     /* 1000-1fff empty */
  553.  
  554.     ROM_REGION( 0x0060, REGION_PROMS )
  555.     ROM_LOAD( "t8.bpr",       0x0000, 0x0020, 0x42a24dd5 ) /* palette */
  556.     ROM_LOAD( "k9.bpr",       0x0020, 0x0020, 0xd736b8de ) /* sprite color lookup table */
  557.     ROM_LOAD( "h9.bpr",       0x0040, 0x0020, 0x27fa3a50 ) /* ?? */
  558. ROM_END
  559.  
  560.  
  561.  
  562. GAME( 1981, ladybug,  0,       ladybug, ladybug,  0, ROT270, "Universal", "Lady Bug" )
  563. GAME( 1982, ladybugb, ladybug, ladybug, ladybug,  0, ROT270, "bootleg", "Lady Bug (bootleg)" )
  564. GAME( 1981?,snapjack, 0,       ladybug, snapjack, 0, ROT0,   "Universal", "Snap Jack" )
  565. GAME( 1981, cavenger, 0,       ladybug, cavenger, 0, ROT0,   "Universal", "Cosmic Avenger" )
  566.